package org.infodavid.common.notifier;

/**
 * The Class Constants.
 */
public final class Constants {

	/**
	 * The Constructor.
	 */
	private Constants() {
		super();
	}

	/** The Constant PRODUCT_NAME. */
	public static String PRODUCT_NAME = "${notifier.name}";

	/** The Constant PRODUCT_VERSION. */
	public static String PRODUCT_VERSION = "${notifier.version}";

	/** The Constant PRODUCT_REVISION. */
	public static String PRODUCT_REVISION = "${notifier.revision}";

	/** Queue prefix. */
	public static final String QUEUE_NAME_PREFIX = "queue/";

	/** Queue name for asynchronous notifications. */
	public static final String NOTIFIER_QUEUE_NAME = "NotifierQueue";

	/** JNDI queue name. */
	public static final String NOTIFIER_QUEUE_JNDI_NAME = QUEUE_NAME_PREFIX + NOTIFIER_QUEUE_NAME;

	/**
	 * The property name used to set and get the host name or IP of the server having notifier
	 * application deployed.
	 */
	public static final String NOTIFIER_HOST_SYSTEM_PROPERTY = "org.infodavid.common.notifier.host";

	/**
	 * The property name used to set the default email for notifications.
	 */
	public static final String SENDER_EMAIL_SYSTEM_PROPERTY =
	    "org.infodavid.common.notifier.sender.email";

	/** The default host IP of the notifier application. */
	public static final String DEFAULT_NOTIFIER_HOST = "127.0.0.1";

	/** The default host IP of the notifier application. */
	public static final String DEFAULT_SENDER_EMAIL = "noreply@infodavid.org";

	/**
	 * The property name used to set the retry count when sending notification to notifier, on client
	 * side.
	 */
	public static final String CLIENT_RETRY_COUNT_SYSTEM_PROPERTY =
	    "org.infodavid.common.notifier.client.retryCount";

	/** The default retry count on client side. */
	public static final int DEFAULT_CLIENT_RETRY_COUNT = 3;

	/**
	 * The property name used to set the retry period when sending notification to notifier, on client
	 * side.
	 */
	public static final String CLIENT_RETRY_PERIOD_SYSTEM_PROPERTY =
	    "org.infodavid.common.notifier.client.retryPeriod";

	/** The default retry period on client side. */
	public static final long DEFAULT_CLIENT_RETRY_PERIOD = 1000;

	/** The constant REMOTE_BEAN_JNDI_NAME. */
	public static final String LOCAL_BEAN_JNDI_NAME = "INotifierBean/local";

	/** The constant REMOTE_BEAN_JNDI_NAME. */
	public static final String REMOTE_BEAN_JNDI_NAME = "INotifierBean/remote";

	static {
		if (PRODUCT_NAME.startsWith("${")) {
			PRODUCT_NAME = "notifier";
		}

		if (PRODUCT_VERSION.startsWith("${")) {
			PRODUCT_VERSION = "0.1-SNAPSHOT";
		}

		if (PRODUCT_REVISION.startsWith("${")) {
			PRODUCT_REVISION = "NA";
		}
	}
}
